package com.filter;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

/**
 * @author CHL
 * @ClassName: Utf8EncodingRequest
 * @Description: 默认使用utf-8字符集
 * @date 2022/8/5 16:26
 * @Version 1.0
 */
public class Utf8EncodingRequest extends HttpServletRequestWrapper {

    public Utf8EncodingRequest(HttpServletRequest request) {
        super(request);
    }
    @Override
    public String getCharacterEncoding() {
        String characterEncoding =this.getRequest().getCharacterEncoding();
        return StringUtils.isBlank(characterEncoding)?"utf-8":characterEncoding;
    }
}
